package com.jt.controller;

import com.jt.pojo.User;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

@Controller
public class UserController {
    //spring容器负责注入service对象
    @Autowired
//    @Qualifier(value = "userService") 如果一个接口有两个实现类 ，且属性的名称与实现类的value不同时，则按照此注解value注入
    private UserService userService;
    @Autowired
    private User user;

    public void addUser(){
        userService.addUser(user);
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }
}
